// source --> //stonecrestmarble.com/wp-content/plugins/advanced-access-manager/media/js/aam-login.js?ver=5.2.7
/**
* ======================================================================
* LICENSE: This file is subject to the terms and conditions defined in *
* file 'license.txt', which is part of this source code package. *
* ======================================================================
*/
if (typeof jQuery !== 'undefined') {
(function ($) {
$('document').ready(function () {
$('.login-input').bind('keyup', function(event) {
if (event.which === 13) {
$('.aam-login-submit').trigger('click');
}
});
$('.aam-login-submit').each(function () {
$(this).bind('click', function () {
var button = $(this);
var prefix = $(this).data('prefix');
var log = $.trim($('#' + prefix + 'log').val());
var pwd = $('#' + prefix + 'pwd').val();
if (log && pwd) {
$('#' + prefix + 'error').css('display', 'none');
$.ajax(aamLocal.ajaxurl, {
data: {
log: log,
pwd: pwd,
action: 'aamlogin',
redirect: $('#' + prefix + 'redirect').val(),
rememberme: ($('#' + prefix + 'rememberme').prop('checked') ? 1 : 0)
},
dataType: 'json',
type: 'POST',
beforeSend: function() {
button.attr({
disabled: 'disabled',
'data-original-label': button.val()
}).val('Wait...');
},
success: function(response) {
if (response.status === "success") {
if (response.redirect) {
location.href = response.redirect;
}
} else {
$('#' + prefix + 'error').html(
response.reason
).css('display', 'block');
}
},
error: function() {
$('#' + prefix + 'error').html(
'ERROR: Unexpected error.'
).css('display', 'block');
},
complete: function() {
button.attr({
disabled: null
}).val(button.attr('data-original-label'));
}
});
} else {
$('#' + prefix + 'error').html(
'ERROR: Username and password are required.'
).css('display', 'block');
}
});
});
});
})(jQuery);
} else {
console.log(
'AAM requires jQuery library in order for login widget to work'
);
};
// source --> https://stonecrestmarble.com/wp-content/plugins/divi_woo_layout_injector/includes/js/jquery.zoom.min.js?ver=5.2.7
/*!
Zoom 1.7.20
license: MIT
http://www.jacklmoore.com/zoom
*/
(function(o){var t={url:!1,callback:!1,target:!1,duration:120,on:"mouseover",touch:!0,onZoomIn:!1,onZoomOut:!1,magnify:1};o.zoom=function(t,n,e,i){var u,c,r,a,m,l,s,f=o(t),h=f.css("position"),d=o(n);return t.style.position=/(absolute|fixed)/.test(h)?h:"relative",t.style.overflow="hidden",e.style.width=e.style.height="",o(e).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:e.width*i,height:e.height*i,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(t),{init:function(){c=f.outerWidth(),u=f.outerHeight(),n===t?(a=c,r=u):(a=d.outerWidth(),r=d.outerHeight()),m=(e.width-c)/a,l=(e.height-u)/r,s=d.offset()},move:function(o){var t=o.pageX-s.left,n=o.pageY-s.top;n=Math.max(Math.min(n,r),0),t=Math.max(Math.min(t,a),0),e.style.left=t*-m+"px",e.style.top=n*-l+"px"}}},o.fn.zoom=function(n){return this.each(function(){var e=o.extend({},t,n||{}),i=e.target&&o(e.target)[0]||this,u=this,c=o(u),r=document.createElement("img"),a=o(r),m="mousemove.zoom",l=!1,s=!1;if(!e.url){var f=u.querySelector("img");if(f&&(e.url=f.getAttribute("data-src")||f.currentSrc||f.src),!e.url)return}c.one("zoom.destroy",function(o,t){c.off(".zoom"),i.style.position=o,i.style.overflow=t,r.onload=null,a.remove()}.bind(this,i.style.position,i.style.overflow)),r.onload=function(){function t(t){f.init(),f.move(t),a.stop().fadeTo(o.support.opacity?e.duration:0,1,o.isFunction(e.onZoomIn)?e.onZoomIn.call(r):!1)}function n(){a.stop().fadeTo(e.duration,0,o.isFunction(e.onZoomOut)?e.onZoomOut.call(r):!1)}var f=o.zoom(i,u,r,e.magnify);"grab"===e.on?c.on("mousedown.zoom",function(e){1===e.which&&(o(document).one("mouseup.zoom",function(){n(),o(document).off(m,f.move)}),t(e),o(document).on(m,f.move),e.preventDefault())}):"click"===e.on?c.on("click.zoom",function(e){return l?void 0:(l=!0,t(e),o(document).on(m,f.move),o(document).one("click.zoom",function(){n(),l=!1,o(document).off(m,f.move)}),!1)}):"toggle"===e.on?c.on("click.zoom",function(o){l?n():t(o),l=!l}):"mouseover"===e.on&&(f.init(),c.on("mouseenter.zoom",t).on("mouseleave.zoom",n).on(m,f.move)),e.touch&&c.on("touchstart.zoom",function(o){o.preventDefault(),s?(s=!1,n()):(s=!0,t(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0]))}).on("touchmove.zoom",function(o){o.preventDefault(),f.move(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0])}).on("touchend.zoom",function(o){o.preventDefault(),s&&(s=!1,n())}),o.isFunction(e.callback)&&e.callback.call(r)},r.setAttribute("role","presentation"),r.src=e.url})},o.fn.zoom.defaults=t})(window.jQuery);
// source --> https://stonecrestmarble.com/wp-content/plugins/divi_woo_layout_injector/includes/js/jquery.colorbox-min.js?ver=5.2.7
/*!
Colorbox 1.6.4
license: MIT
http://www.jacklmoore.com/colorbox
*/
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('').attr({id:Z+"Previous"}),K=t('').attr({id:Z+"Next"}),S=t('').attr({id:Z+"Slideshow"}),L),B=t('').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("
"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("
"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
// source --> https://stonecrestmarble.com/wp-content/plugins/divi_woo_layout_injector/includes/js/imagesloaded.pkgd.min.js?ver=5.2.7
/*!
* imagesLoaded PACKAGED v4.1.3
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return-1==n.indexOf(t)&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return-1!=n&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=0,o=i[n];t=t||[];for(var r=this._onceEvents&&this._onceEvents[e];o;){var s=r&&r[o];s&&(this.off(e,o),delete r[o]),o.apply(this,t),n+=s?0:1,o=i[n]}return this}},t.allOff=t.removeAllListeners=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){var t=[];if(Array.isArray(e))t=e;else if("number"==typeof e.length)for(var i=0;i
https://stonecrestmarble.com/wp-content/plugins/divi_woo_layout_injector/includes/js/script.js?ver=5.2.7
jQuery(document).ready(function () {
if (jQuery('.single-product .sb_woo_product_image').length) {
sb_woo_gen_hidden_images();
jQuery('.single-product .sb_woo_product_image').each(function () {
var large_url = jQuery(this).children('img').attr('src');
if (!jQuery(this).hasClass('sb_woo_image_disable_zoom')) {
jQuery(this).zoom({
callback: function () {
if (!jQuery(this).hasClass('sb_woo_image_disable_lightbox')) {
jQuery('.wli-clone').prepend(jQuery(''))
jQuery(this).click(function() {
jQuery('.wli-clone a').colorbox({rel: 'wli-clone', open: true, maxWidth: '95%', maxHeight: '95%', onClosed: function() { sb_woo_cbox_close(); }});
});
//jQuery(this).colorbox({ href: large_url });
}
}
});
} else {
if (!jQuery(this).hasClass('sb_woo_image_disable_lightbox')) {
jQuery('.wli-clone').prepend(jQuery(''))
jQuery(this).click(function() {
jQuery('.wli-clone a').colorbox({rel: 'wli-clone', open: true, maxWidth: '95%', maxHeight: '95%', onClosed: function() { sb_woo_cbox_close(); } });
});
//jQuery(this).colorbox({ href: large_url });
}
}
});
}
if (jQuery('.single-product .cart.variations_form')) {
////////////////////////////////////////////////
jQuery('.single-product .cart.variations_form .variations .value select').each(function (index, attr) {
jQuery(this).change(function () {
sb_woo_variation_image();
});
});
////////////////////////////////////////////////
}
if (jQuery('.woocommerce-remove-coupon').length) {
jQuery('.et_pb_woo_checkout_coupon').slideUp();
}
//to handle removing items from the cart with a blank response. Note to edit this if no empty cart layout specified
//jQuery(document.body).on('wc_fragments_refreshed', function () {
//if (jQuery('body.woocommerce-cart').length && (!jQuery('.woocommerce-cart-form').length && !jQuery('.sb_et_woo_li_cart_empty').length)) {
//console.log('Woo Injector Refreshing Cart');
//location.reload(); //refresh the page
//}
//});
//to recalculate the product count in cart
jQuery(document.body).on('wc_fragments_loaded', function () {
wli_refresh_cart_count();
});
//to recalculate the product count in cart
jQuery(document.body).on('wc_fragments_refreshed', function () {
wli_refresh_cart_count();
});
if (jQuery('body').hasClass('wli_injected')) {
if (jQuery('.wpcf7').length > 0) {
var wli_post_id, matches = document.body.className.match(/(^|\s)postid-(\d+)(\s|$)/);
if (matches) {
jQuery("input[name='_wpcf7_container_post']").val(matches[2]);
jQuery(".wpcf7-submit").addClass('button');
jQuery(".wpcf7-form > p").addClass('form-row');
jQuery(".wpcf7-form > p .wpcf7-form-control-wrap input").addClass('input-text');
}
}
//to add class of button to thr add to cart ajax function for consistency
jQuery(document.body).on('added_to_cart', function () {
setTimeout(function () {
jQuery('.added_to_cart').addClass('button');
}, 50);
});
//to handle showing the coupon system in a lightbox
jQuery(document.body).on("checkout_error", function () {
if (jQuery('.woocommerce-NoticeGroup').length) {
sb_woo_popup_notice(jQuery('.woocommerce-NoticeGroup').html());
setTimeout(function () {
jQuery('.woocommerce-NoticeGroup').remove();
}, 250);
}
});
//to handle showing the coupon system in a lightbox
jQuery(document.body).on("updated_wc_div", function () {
if (jQuery('.woocommerce .woocommerce-error').length) {
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-error'));
jQuery('.entry-content .woocommerce .woocommerce-error').remove();
}
if (jQuery('.woocommerce .woocommerce-message').length) {
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-message').clone().wrap(""));
jQuery('.entry-content .woocommerce .woocommerce-message').remove();
}
if (jQuery('.cart-empty').length > 0) {
jQuery('.et_pb_woo_cart_totals').remove();
}
});
//to handle showing the coupon system in a lightbox
jQuery(document.body).on("applied_coupon", function () {
if (jQuery('.woocommerce .woocommerce-error').length) {
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-error'));
jQuery('.entry-content .woocommerce .woocommerce-error').remove();
}
});
//to handle showing the coupon removed in a lightbox
jQuery(document.body).on("removed_coupon", function () {
if (jQuery('.woocommerce .woocommerce-message').length) {
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-message').clone().wrap(""));
jQuery('.entry-content .woocommerce .woocommerce-message').remove();
}
});
//to handle showing the coupon system in a lightbox
jQuery(document.body).on("update_checkout", function () {
if (jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-error').length) {
sb_woo_popup_notice(jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-error').clone().wrap(""));
jQuery('.et_pb_woo_checkout_coupon').slideDown();
} else if (jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-message').length) {
sb_woo_popup_notice(jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-message').clone().wrap(""));
jQuery('.coupon-module').val('');
if (jQuery('.woocommerce-remove-coupon').length) {
jQuery('.et_pb_woo_checkout_coupon').slideDown();
} else {
jQuery('.et_pb_woo_checkout_coupon').slideUp();
}
} else if (jQuery('.woocommerce .woocommerce-message').length) {
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-message').clone().wrap(""));
setTimeout(function () {
jQuery('.entry-content > .woocommerce > .woocommerce-message').remove();
}, 250);
}
});
}
});
function wli_refresh_cart_count() {
var wli_new_count = 0;
if (jQuery('.sb_woo_mini_cart ul li').length) {
jQuery('.sb_woo_mini_cart ul li').each(function () {
var wli_quantity = jQuery(this).children('.quantity').text();
var wli_quantity_nums = wli_quantity.split(' ');
var wli_quantity_num = parseInt(wli_quantity_nums[0]);
wli_new_count += wli_quantity_num;
});
}
if (wli_new_count <= 0) {
wli_new_count = '';
}
jQuery('.sb_woo_prod_cart_container .et-cart-info span').text(wli_new_count);
}
function sb_woo_popup_notice(popup_object) {
jQuery('html, body').scrollTop(0);
jQuery.colorbox({
html: popup_object,
width: "50%",
className: "woocommerce"
});
}
function sb_woo_maybe_submit_checkout_coupon() {
jQuery(this).keypress(function (e) {
if (e.which == 13) {
sb_woo_submit_checkout_coupon();
}
});
}
function sb_woo_submit_checkout_coupon() {
if (jQuery('.coupon-module').length) {
jQuery('.coupon-module').parent().removeClass('woocommerce-invalid').removeClass('woocommerce-validated');
var coupon = jQuery('.coupon-module').val();
if (coupon != '') {
jQuery('#coupon_code').val(coupon);
jQuery('.checkout_coupon').submit();
} else {
jQuery('.coupon-module').parent().addClass('woocommerce-invalid').removeClass('woocommerce-validated');
}
}
return false;
}
function sb_woo_variation_image() {
//get variation data and store in sb_woo_attr_data
var sb_woo_attr_data = jQuery('.single-product .cart.variations_form').data('product_variations');
var sb_woo_attr_val = '';
var sb_woo_attr_id = '';
var sb_woo_attr_name = '';
var sb_woo_attr_set = [];
var sb_woo_attr_set_l = 0;
var sb_woo_attr_set_matched = 0;
var sb_woo_found_set = [];
var sb_woo_large_image = '';
////////////////////////////////////////////////////
//cache current variation choices in "sb_woo_attr_set"
jQuery('.single-product .cart.variations_form .variations .value select').each(function (index2, attr2) {
sb_woo_attr_val = jQuery(this).val();
sb_woo_attr_id = jQuery(this).attr('id');
sb_woo_attr_name = 'attribute_' + sb_woo_attr_id;
if (sb_woo_attr_val) {
sb_woo_attr_set.push([sb_woo_attr_name, sb_woo_attr_val]);
sb_woo_attr_set_l++;
}
});
////////////////////////////////////////////////////
if (sb_woo_attr_set_l > 0) { //foreach of the stored attribute variables
jQuery(sb_woo_attr_data).each(function (index3, attr3) { //loop variation prices
var sb_woo_attrs = attr3.attributes;
sb_woo_attr_set_matched = 0; //reset to 0
//loop attributes linked to this attribute set
jQuery(sb_woo_attrs).each(function (index4, attr4) {
jQuery(attr4).each(function (index4, attr4) {
jQuery(sb_woo_attr_set).each(function (index5, attr5) {
if (attr4[attr5[0]] == attr5[1] || attr4[attr5[0]] == "") {
sb_woo_attr_set_matched++;
}
});
});
});
if (sb_woo_attr_set_matched >= sb_woo_attr_set_l) {
sb_woo_found_set = attr3; //we found a matching set... store it!
}
});
if (typeof sb_woo_found_set.image !== 'undefined') {
sb_woo_large_image = sb_woo_found_set.image.full_src;
} else {
sb_woo_large_image = jQuery('.sb_woo_product_thumb_col_num_1 a').data('large_image');
}
if (jQuery('.sb_woo_product_image_container').length) {
sb_woo_product_thumb_replace_by_url(sb_woo_large_image, jQuery('.sb_woo_product_image_container')); //we aren't selecting the same element here so just grab the image directly
}
}
}
function sb_woo_cbox_close() {
//jQuery('a.wli-core').remove();
//jQuery('a.wli-added').remove();
}
function sb_woo_gen_hidden_images() {
//var $gallery = jQuery('').appendTo('body');
var $gallery = jQuery('
').hide().appendTo('body');
var arr = jQuery('a.sb-woo-images');
var large_image = '';
jQuery.each(arr, function (i) {
if (large_image = jQuery(this).data('large_image')) {
jQuery('
').appendTo($gallery);
}
});
//$gallery.find('a').colorbox({rel: 'wli-clone', open: true});
}
function sb_woo_product_thumb_replace_by_url(large_image, image_object) {
if (jQuery('.single-product .sb_woo_product_image img').attr('src') == large_image) {
return;
}
var parent_object = image_object.closest('.sb_woo_product_image_container');
if (parent_object.length == 0) {
var parent_object = jQuery('.sb_woo_product_image_container');
}
if (parent_object.length) {
parent_object.find('.sb_woo_product_image img').trigger('zoom.destroy'); // remove zoom
parent_object.find('.sb_woo_product_image img.zoomImg').remove(); //remove old zoom image
var image_height = parent_object.find('.sb_woo_product_image img').height();
parent_object.find('.sb_woo_product_image').css('height', image_height + 'px');
parent_object.find('.sb_woo_product_image img').fadeOut(400, function () {
parent_object.find('.sb_woo_product_image img').attr('src', large_image);
parent_object.find('.sb_woo_product_image').imagesLoaded(function () {
var image_height = parent_object.find('.sb_woo_product_image img').height();
parent_object.find('.sb_woo_product_image').css('height', image_height + 'px');
parent_object.find('.sb_woo_product_image img').fadeIn(400, function () {
if (!parent_object.find('.sb_woo_product_image').hasClass('sb_woo_image_disable_zoom')) {
parent_object.find('.sb_woo_product_image').zoom({
callback: function () {
if (!parent_object.find('.sb_woo_product_image').hasClass('sb_woo_image_disable_lightbox')) {
jQuery.each(jQuery('.wli-clone a'), function() {
if (jQuery(this).attr('href') == parent_object.find('.sb_woo_product_image img').attr('src')) {
jQuery(this).remove();
}
});
jQuery('.wli-clone').prepend(jQuery('
'));
//jQuery(this).colorbox({ href: parent_object.find('.sb_woo_product_image img').attr('src') });
parent_object.find('.sb_woo_product_image').click(function() {
jQuery('.wli-clone a').colorbox({rel: 'wli-clone', open: true, maxWidth: '95%', maxHeight: '95%', onClosed: function() { sb_woo_cbox_close(); } });
});
}
}
});
} else {
if (!parent_object.find('.sb_woo_product_image').hasClass('sb_woo_image_disable_lightbox')) {
jQuery.each(jQuery('.wli-clone a'), function() {
if (jQuery(this).attr('href') == parent_object.find('.sb_woo_product_image img').attr('src')) {
jQuery(this).remove();
}
});
jQuery('.wli-clone').prepend(jQuery('
'))
parent_object.find('.sb_woo_product_image').click(function() {
jQuery('.wli-clone a').colorbox({rel: 'wli-clone', open: true, maxWidth: '95%', maxHeight: '95%', onClosed: function() { sb_woo_cbox_close(); }});
});
//jQuery('.sb_woo_product_image').colorbox({ href: parent_object.find('.sb_woo_product_image img').attr('src') });
}
}
});
});
});
} else {
jQuery.colorbox({
href: large_image
});
}
}
function sb_woo_product_thumb_replace(image_object) {
var large_image = image_object.data('large_image');
sb_woo_product_thumb_replace_by_url(large_image, image_object);
};